// import React, { Component } from 'react'
// import { withRouter } from 'react-router-dom'


// class App extends Component {
//   render() {
//     return (
//       <div className='box'>
//         <div>{this.props.children}</div>
//       </div>
//     )
//   }
//   UNSAFE_componentWillMount() {
//     // console.log(this.props);
//     if (this.props.location.pathname === '/') {
//       this.props.history.push('/home')
//     }

//   }
// }

// export default withRouter(App)

import React, { useEffect } from 'react'
import { useHistory } from 'react-router-dom'
import Nav from "./components/Nav"
import Loading from './components/Loading'
import { Provider } from 'react-redux'
import store from './store'
import Toast from './components/Toast'

function App(props) {
  let history = useHistory()
  useEffect(() => {
    if (history.location.pathname === '/') {
      history.push('/home')
    }
  }, [])
  // console.log(props);
  return (
    <Provider store={store}>
      <>{props.children}</>
      {/* <Loading></Loading> */}
      <Toast />
      <Nav history={history} />
    </Provider>
  )
}

export default App
